package com.gisuni.sddc.platformManager.dao;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

import com.gisuni.sddc.platformManager.model.Attachment;

@IocBean
public class AttachmentDao {

	@Inject
	private BasicDao basicDao;
	
	
	public void addAttachment(Attachment attachment) {
    	   basicDao.save(attachment);  
	}


	public boolean deleteAttachmentById(String id) {
		Cnd cnd=Cnd.where("id","=",id);
		return basicDao.delete(Attachment.class, cnd);
	}


	public boolean updateAttachmentDownStatusById(String id, String status) {
		Cnd cnd=Cnd.where("id","=",id);
		Attachment attachment= basicDao.findByCondition(Attachment.class, cnd);
		attachment.setFlag(status);
		return basicDao.update(attachment);
	}
}
